<!--
 * @Author: Orangepi - xcy2001@sina.cn
 * @Date: 2022-01-01 14:23:54
 * @LastEditTime: 2022-01-01 23:14:35
 * @LastEditors: Orangepi - xcy2001@sina.cn
 * @Description:
 * @FilePath: \college-application-enrollment-uniapp\cae-uniapp\src\pages\index\index.vue
-->

<template>
  <view class="content">
    <!-- <image class="logo" src="/static/logo.png"></image> -->
    <view>
      <text>用户名</text>
      <input
        class="e-input"
        v-model="user.userName"
        placeholder="请输入用户名"
      />
      <text>密码</text>
      <input class="e-input" v-model="user.userPsd" placeholder="请输入密码" />
      <button @click="Login">登录</button>
      <text>{{ loginres }}</text>
    </view>
  </view>
</template>

<script>
import { loginHttp } from "../../network/user.api";
export default {
  data() {
    return {
      title: "Hello",
      loginres: "",
      user: {
        userName: "",
        userPsd: "",
      },
    };
  },
  onLoad() {
    this.title = "???";
  },
  methods: {
    async Login() {
      const { userName, userPsd } = this.user;
      this.loginres = "用户名" + userName + "\n密码：" + userPsd;
      let res = await loginHttp({ userName, userPsd });
      console.log("333",res);
      if (res) {
        this.loginres = res.msg;
      }
    },
  },
};
</script>

<style>
.content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.logo {
  height: 200rpx;
  width: 200rpx;
  margin: 200rpx auto 50rpx auto;
}

.text-area {
  display: flex;
  justify-content: center;
}

.title {
  font-size: 36rpx;
  color: #8f8f94;
}
.e-input {
  padding: 10px;
  margin: 10px;
  border: 1px solid #949494;
  border-radius: 10px;
}
.span-center {
  margin: 0 auto;
}
</style>
